<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>书籍管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        function uploadMarcForm() {
            $("#uploadMarcForm").submit();
        }
        /**
         * 保存
         */
        function saveBookInfo() {
            loading('正在提交，请稍等...');
            $.ajax({
                type: "POST",
                url: "${ctx}/book/manage/save",
                dataType: "json",
                success: function (data) {
                    resetTip();
                    if("0001" == data.code){
                        top.$.jBox.info(data.msg, '提示', {closed:function(){
                            window.location.href = "${ctx}/book/manage/list";
                        }});
                    }else{
                        alertx(data.msg);
                    }
                }
            });
        }
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li>
        <a href="${ctx}/book/manage/list">书目列表</a>
    </li>
    <li class="active">
        <a href="${ctx}/book/manage/form">导入marc</a>
    </li>
    <li>
        <a href="${ctx}/book/manage/get">新增书目</a>
    </li>
</ul>
    <form:form id="uploadMarcForm" action="${ctx}/book/manage/analyse" method="post" class="form-horizontal" enctype="multipart/form-data">
        <div style="position: fixed;background-color: white; width: 100%" class="control-group">
            <label class="control-label">选择数据文件：</label>

            <div class="controls">
                <input name="mfile" type="file" onchange="uploadMarcForm()"/>
                <a href="${ctx}/book/manage/template" class="btn">下载Excel模板</a>&nbsp;&nbsp;
            </div>
        </div>
    </form:form>

    <div id="bookData" style="padding: 50px;overflow-y:auto; height:600px;">
        <table width='100%' border='1'>
            <tr>
                <th width='30'>序号</th>
                <th width='200'>书名</th>
                <th width='150'>作者</th>
                <th>ISBN</th>
                <th>出版社</th>
                <th>出版日期</th>
                <th>价格</th>
            </tr>
            <tbody>
            <c:forEach items="${cnmarcList}" var="cnmarc" varStatus="status">
                <tr>
                    <td width='50' align='center'>${status.count}</td>
                    <td>${cnmarc.bookname}</td>
                    <td>${cnmarc.author}</td>
                    <td>${cnmarc.isbn}</td>
                    <td>${cnmarc.publisher}</td>
                    <td>${cnmarc.pubdate}</td>
                    <td align='right'>${cnmarc.price}</td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
    <input id="btnSubmit" class="btn btn-primary" type="submit" onclick="saveBookInfo()" value="导 入"/>&nbsp;
</body>
</html>